import Vue from "vue";
import App from "./App";
import PageWrap from "./components/PageWrap";
import uView from "uview-ui";
// import VConsole from "vconsole";
// #ifdef H5
import { getTradeInfoByUrl } from "./api/index";
// #endif


const $config = require("./config");

// import VueAwesomeSwiper from 'vue-awesome-swiper'
// import 'swiper/css/swiper.css'
// Vue.use(VueAwesomeSwiper)

// const vConsole = new VConsole();
Vue.use(uView);

Vue.component("PageWrap", PageWrap);
Vue.config.productionTip = false;
Vue.prototype.$bus = new Vue();
Vue.prototype.$im = null;
for (let key in $config) {
  Vue.prototype["$" + key] = $config[key];
}

App.mpType = "app";

// #ifdef H5
let param = {
  myUrl: window.location.host,
};
getTradeInfoByUrl(param).then((res) => {
  if (res && res.tradeid) {
    Vue.prototype.$tradeId = res.tradeid;
    Vue.prototype.$productName = res.homename;
    Vue.prototype.$selfName = res.homename;
  }
  const app = new Vue({
    ...App,
  });
  app.$mount();
  const ThemeData = $config.themeVar[$config.theme];
  for (let key in ThemeData) {
    document.documentElement.style.setProperty(`--${key}`, ThemeData[key]);
  }
});
// #endif
// #ifdef MP-WEIXIN
const app = new Vue({
  ...App,
});
app.$mount();
// #endif
